import React from 'react';
import { BraftEditorComp, ButtonComp } from 'jh-lib';
import {SearchOutlined} from "@ant-design/icons";
import { Form } from "antd"


export default () => {
    let braftRef = null;
    const [form] = Form.useForm();
    return (
        <>
            <ButtonComp style={{marginRight: 10}} onClick={()=>{
                form.setFieldsValue({
                    ed: `<p>99999</p>`
                })
            }}>初始值</ButtonComp>
            <ButtonComp onClick={()=>{
                if(braftRef && braftRef.setValue){
                    braftRef.setValue("<p>9999966666621110000</p>")
                }
            }}>联动按钮</ButtonComp>
            <Form
                style={{marginTop: 10}}
                form={form}
                onValuesChange={(val)=>{
                    console.log("change:", val);
                }}>
                <BraftEditorComp
                    onRef={ref => braftRef = ref}
                    fieldName={"ed"}
                    compLabel={'富文本'}
                    // style={{height: 600}}
                    isDrag={true}
                />
            </Form>
        </>
    )
};